define(function(require,exports,module){
    var Validator = require("../common/validator.js");
    var myWidGet = require("../common/myWidGet.js");
    require("../common/serializeObject")
    var FormValidator = {
        editValidator:function(element){
            var v = new Validator({
                attrs:{
                    itemClass:"test"
                },
                element:element,
                autoSubmit:false,
                onFormValidated:function(err,results,form){
                    /*判断是否有id*/
                    if(!err){
                        var info = $("#targetManageSetting").serializeObject();
                        $.ajax({
                            url:window.jkconfig.webapiurlv+$(this).attr("data-action"),
                            data:info,
                            type:'POST',
                            contentType: 'application/json;charset=UTF-8',
                            success:function(data){
                                if(data.code == 0){
                                    $.showSuccessTimeout(data.msg,function(){

                                    })
                                }else{
                                    $.showErr(data.msg);
                                }
                            }
                        })
                    }
                },
                failSilently: true
            });
            v.addItem({
                element:'input',
                required:true,
                display:'序号',
                rule:"number"
            })
        }
    }
    module.exports = FormValidator;
})



